using System;
using System.Collections.Generic;
using System.Text;
using Caece.Libreria.Protocolo;

namespace Caece.Libreria.FrontEnd.Console
{
	class Program
	{
		private static int _frontEndTimeOut;
		private static int _port;
		private static int _dnsPort;
		private static string _dnsIP;

		static void Main(string[] args)
		{
			_port = Convert.ToInt32(args[0]);
			Random r = new Random(_port);
			int segundos = r.Next(5, 40);

			_frontEndTimeOut = Util.GetConfig<int>("FrontEnd_TimeOut");
			_dnsPort = Util.GetConfig<int>("DNS_Port");
			_dnsIP = Util.GetConfig<string>("DNS_IP");

			BerkeleyNode server = new BerkeleyNode(_frontEndTimeOut, _port, _dnsIP, _dnsPort, new TimeSpan(0, 0, segundos));			
			server.Start();
		}
	}
}
